package share.threadLocal;

/**
 * @author 小石潭记
 * @date 2021/4/20 19:49
 * @Description:  https://mp.weixin.qq.com/s/op_ix4tPWa7l8VPg4Al1ig
 */
public class Test {

    private static ThreadLocal<String> threadLocal = ThreadLocal.withInitial(()->"小石潭记");

    public static void main(String[] args) {
        System.out.println("获取初始值："+threadLocal.get());
        threadLocal.set("作者 柳宗元");
        System.out.println("获取修改后的值："+threadLocal.get());
        threadLocal.remove();
    }
}
